import * as types from './../constants/ActionTypes';

/*
 * 设备信息保存
 ================================================================*/
export function saveDevice({deviceid = "", mobilemodel = "", mobileos = "", screenwidth = "", screenheight = "", channelid : baiduid="", devicetype=""} = {}) {
  return  (dispatch) => {

    let payload = { 
      device_status : 0, 
      message : '加载中'
    };

    dispatch({
      payload,
      type: [types.SAVE_DEVICEINFO, types.SAVE_DEVICEINFO_SUCCESS, types.SAVE_DEVICEINFO_FAILURE],
      meta: {
        fetch: [`member/devicesave`, {
        	method: 'post',
        	body: `deviceid=${deviceid}&mobilemodel=${mobilemodel}&mobileos=${mobileos}&screenwidth=${screenwidth}&screenheight=${screenheight}&baiduid=${baiduid}&devicetype=${devicetype}`
        }]
      }  
    });
  };
}
